<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri = "http://java.sun.com/jsp/jstl/core" prefix = "c" %>
<%@ taglib uri = "http://java.sun.com/jsp/jstl/xml" prefix = "x" %>
<%@ taglib uri = "http://java.sun.com/jsp/jstl/fmt" prefix = "f" %>
<%@ taglib uri = "http://java.sun.com/jsp/jstl/sql" prefix = "sql" %>
<%@ taglib uri = "http://java.sun.com/jsp/jstl/functions" prefix = "fn" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>list here</title>
</head>
<body>
	<a href="add">Add</a><br/>
	<table border="1">
	  	<c:forEach var="puser"  items="${products}" >
	     <tr><td>${puser.id}</td><td>${puser.userName}</td><td>${puser.age}</td>
	     <td><a href="show?id=${puser.id}">查看</a>  
             <a href="update?id=${puser.id}">修改</a>  
             <a href="delete?id=${puser.id}">删除</a></td>
	     </tr>
		</c:forEach>
	</table>
    <!-- 分页功能 start -->  
    <div align="center">  
        <font size="2">共 ${page.totalPageCount} 页</font> <font size="2">第  
            ${page.pageNow} 页</font> <a href="list?pageNow=1">首页</a>  
        <c:choose> 
            <c:when test="${page.pageNow - 1 > 0}">  
                <a href="list?pageNow=${page.pageNow - 1}">上一页</a>  
            </c:when>  
            <c:when test="${page.pageNow - 1 <= 0}">  
                <a href="list?pageNow=1">上一页</a>  
            </c:when>  
        </c:choose>
        <c:choose>  
            <c:when test="${page.totalPageCount==0}">  
                <a href="list?pageNow=${page.pageNow}">下一页</a>  
            </c:when>  
            <c:when test="${page.pageNow + 1 < page.totalPageCount}">  
                <a href="list?pageNow=${page.pageNow + 1}">下一页</a>  
            </c:when>  
            <c:when test="${page.pageNow + 1 >= page.totalPageCount}">  
                <a href="list?pageNow=${page.totalPageCount}">下一页</a>  
            </c:when>  
        </c:choose>  
        <c:choose>  
            <c:when test="${page.totalPageCount==0}">  
                <a href="list?pageNow=${page.pageNow}">尾页</a>  
            </c:when>  
            <c:otherwise>  
                <a href="list?pageNow=${page.totalPageCount}">尾页</a>  
            </c:otherwise>  
        </c:choose>  
     </div>  
     <!-- 分页功能 End -->
</body>
</html>